<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>
<%@ taglib uri="/WEB-INF/lib/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/lib/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/lib/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/lib/c.tld" prefix="c"%>

<script type="text/javascript">

function removeMoviment(movimentId){
	document.movimentForm.opr.value = 'remove';
	document.movimentForm.id.value = movimentId;
	if (confirm('<bean:message key="moviment.remove.confirmationPrompt" />')){
		document.movimentForm.submit();
	}
}

</script>

<h1><small><small><small>Ve&iacute;culo</small></small></small></h1>

<html:form action="/moviment">
	<html:hidden property="opr" />
	<html:hidden property="id" />
	
	
</html:form>
	
<table border="0" width="100%">
		<tr>
			<td>
			<table border="0" width="100%">
				<tr>
					<td width="25%"><bean:message key="vehicle.labels.plate" /> </td> 
					<td><bean:write name="vehicle" property="plate"/></td>
				</tr>
				<tr>
					<td width="25%"><bean:message key="vehicle.labels.year" /> </td>
					<td><bean:write name="vehicle" property="year"/></td>
				</tr>
				<tr>
					<td width="25%"><bean:message key="vehicle.labels.value" /> </td>
					<td><bean:write name="vehicle" property="value"/></td>
				</tr>
				<tr>
					<td width="25%"><bean:message key="vehicle.labels.city" /> </td> 
					<td><bean:write name="vehicle" property="location.city"/></td>
				</tr>
				<tr>
					<td width="25%"><bean:message key="vehicle.labels.state" /> </td> 
					<td><bean:write name="vehicle" property="location.state"/></td>
				</tr>
				<tr>
					<td width="25%"><bean:message key="vehicle.labels.brand" /> </td> 
					<td><bean:write name="vehicle" property="model.brand.brand"/></td>
				</tr>
				<tr>
					<td width="25%"><bean:message key="vehicle.labels.model" /> </td> 
					<td><bean:write name="vehicle" property="model.model"/></td>
				</tr>
				<tr>	
					<td width="25%"><bean:message key="vehicle.labels.fuel" /> </td> 
					<td><bean:write name="vehicle" property="fuel.fuel"/></td>
				</tr>
				<tr>
					<td width="25%"><bean:message key="vehicle.labels.color" /> </td> 
					<td><bean:write name="vehicle" property="color.color"/></td>
				</tr>
			</table>
			</td>
		</tr>
	</table>

<h1><small><small><small>Movimenta&ccedil;&otilde;es</small></small></small></h1>

<table width="100%" style="border: 1px solid #969696;" cellpadding="0" cellspacing="0">
	<tr style="background-color: #969696; height: 20px; font-weight: bold;">
		<td width="25%">data</td>
		<td width="25%">tipo</td>
<!--		<td width="25%">kilometragem</td> -->
		<td width="25%">valor</td>
		<td width="5%">valor</td>
	</tr>
	
	<logic:iterate id="moviment" name="movimentsCollection" >
	
	<c:if test="${color == one}">
		<c:set var="color" value="#f3f2f2" />
	</c:if>
	<c:if test="${color == two}">
		<c:set var="color" value="#e7e6e6" />
	</c:if>
		
		<tr style="background-color: ${color} height: 15px;">
			<td><bean:write name="moviment" property="date"/></td>
			<td><bean:write name="moviment" property="eventType.eventType"/></td>
			<td><bean:write name="moviment" property="value"/></td>
			<td><a href="javascript:removeMoviment('<bean:write name="moviment" property="id"/>');"><img src="resources/excluir.gif" border="0" alt="Excluir Movimento"/></a></td>
		</tr>
	
	</logic:iterate>

</table>

<br>
<a href="moviment.do?opr=load">Voltar</a>
